package cn.ld.module.infra.dal.mapper.demo.demo03;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.module.infra.dal.entity.demo.demo03.Demo03StudentEntity;
import org.apache.ibatis.annotations.Mapper;
import cn.ld.module.infra.controller.admin.demo.demo03.vo.*;

/**
 * 学生 Mapper
 *
 * @author 蓝盾
 */
@Mapper
public interface Demo03StudentMapper extends BaseMapperX<Demo03StudentEntity> {

    default PageResult<Demo03StudentEntity> selectPage(Demo03StudentPageInVO inVO) {
        return selectPage(inVO, new LambdaQueryWrapperX<Demo03StudentEntity>()
                .likeIfPresent(Demo03StudentEntity::getName, inVO.getName())
                .eqIfPresent(Demo03StudentEntity::getSex, inVO.getSex())
                .eqIfPresent(Demo03StudentEntity::getDescription, inVO.getDescription())
                .betweenIfPresent(Demo03StudentEntity::getCreateTime, inVO.getCreateTime())
                .orderByDesc(Demo03StudentEntity::getId));
    }

}